// 管理这个项目的所有接口
import axios from "@/utils/request"

// 请求首页数据
export const GetHomeData = () => axios.get("/index/index");

// 请求历史记录和热门搜索 （get请求无参数的写法）
export const GetHishotData = () => axios.get("/search/index");


// 请求搜索提示列表  (get请求携带参数的写法)
export const GetSearchTipsData = (params) => axios.get("/search/helper", {params});


// 请求搜索产品列表信息
export const GetGoodsListData = (params) => axios.get("/goods/list", {params});

// 请求清除历史记录
export const ClearHistory = () => axios.post("/search/clearhistory");

//根据商品id获取商品详情
export const GetGoodsDetail = (id) => axios.get(`/goods/detail?id=${id}`);

//新品相关产品
export const GetRelated = (id) => axios.get(`/goods/related?id=${id}`);

//加入购物车
export const AddShopCar = (params) => axios.post("/cart/add", {
    goodsId: params.goodsId,
    productId: params.productId,
    number: params.number,
});

//获取购物车产品数量
export const getGoodsCount = () => axios.get("/cart/goodscount");

//获取购物车商品信息
export const getShopCarInfo = () => axios.get("/cart/index");

//点击切换商品选中状态
export const ChangeGoodsChecked = params => axios.post("/cart/checked", params);

//点击增加商品数量和减少商品数量
export const updateGoodsCar = (params) => axios.post("/cart/update", params)

//点击删除商品
export const deleteGoodsCar = params => axios.post("/cart/delete", {
    productIds: params,
})

// label页面数据请求
export const getTopicList = params => axios.get("/topic/list", {params})

//分类页单个标签一个数据请求
export const getCategoryOnePage = params => axios.get("/catalog/current", {params});

//分类也全部信息
export const getCategoryAll = () => axios.get("/catalog/index");

//标签页
export const getChannel = params => axios.get("/goods/category", {params});


export const getGoodsList = params => axios.get("/goods/list", {params});
